# 导包
from time import sleep

from selenium import webdriver

# 获取浏览器驱动对象
driver = webdriver.Chrome()

# 打开url
driver.get("https://demo.ruoyi.vip/login")
sleep(5)
driver.find_element_by_id("btnSubmit").click()
sleep(3)
driver.get("https://demo.ruoyi.vip/system/user/add")

# 输入 admin
driver.find_element_by_css_selector('[name="loginName"]').send_keys("admin")

# 输入 admin
driver.find_element_by_css_selector('[name="userName"]').send_keys("admin")

# 输入 密码 123456
driver.find_element_by_css_selector('[name="remark"]').send_keys("123456")

# 输入 电话 18611112222
driver.find_element_by_id("phonenumber").send_keys("18611112222")

# 输入邮箱 123@qq.com
driver.find_element_by_id("email").send_keys("123@qq.com")

# 暂停3 秒
sleep(3)

# 修改电话号码 18622223333 --> 清空操作
driver.find_element_by_id("phonenumber").clear()
driver.find_element_by_id("phonenumber").send_keys("18622223333")

# 暂停3秒
sleep(3)

# 点击注册按钮
driver.find_element_by_class_name("btn-primary").click()

# 暂停3秒
sleep(3)

# 关闭浏览器驱动对象
driver.close()
